var e = require;
var t = module;
var o = exports;
var n,
    i = o,
    a =
        ((n = function (e, t) {
            return (n =
                Object.setPrototypeOf ||
                ({__proto__: []} instanceof Array &&
                    function (e, t) {
                        e.__proto__ = t;
                    }) ||
                function (e, t) {
                    for (var o in t) t.hasOwnProperty(o) && (e[o] = t[o]);
                })(e, t);
        }),
        function (e, t) {
            function o() {
                this.constructor = e;
            }
            n(e, t), (e.prototype = null === t ? Object.create(t) : ((o.prototype = t.prototype), new o()));
        }),
    r = function (e, t, o, n) {
        var i,
            a = arguments.length,
            r = a < 3 ? t : null === n ? (n = Object.getOwnPropertyDescriptor(t, o)) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(e, t, o, n);
        else
            for (var s = e.length - 1; s >= 0; s--)
                (i = e[s]) && (r = (a < 3 ? i(r) : a > 3 ? i(t, o, r) : i(t, o)) || r);
        return a > 3 && r && Object.defineProperty(t, o, r), r;
    };
Object.defineProperty(i, "__esModule", {value: !0});
var s = cc._decorator,
    c = s.ccclass,
    l = s.property,
    d = (function (e) {
        function t() {
            var t = (null !== e && e.apply(this, arguments)) || this;
            return (
                (t.node_head = null),
                (t.node_tail = null),
                (t.nodes_body = []),
                (t._ani_timer = 0.5),
                (t._initX = 10),
                (t._addX = 6),
                (t._initR = 10),
                (t._addR = 10),
                t
            );
        }
        return (
            a(t, e),
            (t.prototype.start = function () {
                var e = this;
                this.node_head.stopAllActions(),
                    (this.node_head.angle = 0),
                    this.node_head.runAction(
                        cc.repeatForever(cc.sequence(cc.rotateTo(0.5, 10), cc.rotateTo(0.5, -10)))
                    );
                for (
                    var t = function (t) {
                            var n = o.nodes_body[t];
                            n.stopAllActions(),
                                (n.y = o.node_head.y + 35 * (t + 1)),
                                (n.x = 0),
                                (n.angle = 0),
                                n.runAction(
                                    cc.sequence(
                                        cc.delayTime(0.1 * t),
                                        cc.callFunc(function () {
                                            n.runAction(
                                                cc.repeatForever(
                                                    cc.sequence(
                                                        cc.spawn(
                                                            cc.moveTo(e._ani_timer, -e._initX - e._addX * t, n.y),
                                                            cc.rotateBy(e._ani_timer, e._initR + e._addR * t)
                                                        ),
                                                        cc.spawn(
                                                            cc.moveTo(e._ani_timer, e._initX + e._addX * t, n.y),
                                                            cc.rotateBy(e._ani_timer, -(e._initR + e._addR * t))
                                                        )
                                                    )
                                                )
                                            );
                                        })
                                    )
                                );
                        },
                        o = this,
                        n = 0;
                    n < this.nodes_body.length;
                    n++
                )
                    t(n);
                this.node_tail.stopAllActions(),
                    (this.node_tail.x = 0),
                    (this.node_tail.angle = 0),
                    (this.node_tail.y = this.node_head.y + 35 * (this.nodes_body.length + 1)),
                    this.node_tail.runAction(
                        cc.sequence(
                            cc.delayTime(0.1 * this.nodes_body.length),
                            cc.callFunc(function () {
                                e.node_tail.runAction(
                                    cc.repeatForever(
                                        cc.sequence(
                                            cc.spawn(
                                                cc.moveTo(
                                                    e._ani_timer,
                                                    -e._initX - e.nodes_body.length * e._addX,
                                                    e.node_tail.y
                                                ),
                                                cc.rotateBy(e._ani_timer, e._initR + e._addR * e.nodes_body.length)
                                            ),
                                            cc.spawn(
                                                cc.moveTo(
                                                    e._ani_timer,
                                                    e._initX + e.nodes_body.length * e._addX,
                                                    e.node_tail.y
                                                ),
                                                cc.rotateBy(e._ani_timer, -(e._initR + e._addR * e.nodes_body.length))
                                            )
                                        )
                                    )
                                );
                            })
                        )
                    );
            }),
            r([l(cc.Node)], t.prototype, "node_head", void 0),
            r([l(cc.Node)], t.prototype, "node_tail", void 0),
            r([l([cc.Node])], t.prototype, "nodes_body", void 0),
            r([c], t)
        );
    })(cc.Component);
i.default = d;
